/**
 * Created by jean.h.ma on 01/04/2018.
 */

import React from 'react'
import Base from '@codefree/badger/app/components/Base'
import PropTypes from 'prop-types'

export default class HelloWorld extends Base {
	static propTypes = {
		text: PropTypes.string.isRequired
	};

	constructor(props) {
		super(props);
		this.state = {
			value: ""
		};
	}

	render() {
		return (
			<div>
				<p>hello {this.props.text}!</p>
				<p>value:{this.state.value}</p>
				<button type="button" onClick={() => {
					this.updateState({
						value: {$set: "abc"}
					})
					// this.setState({
					// 	value: "abc"
					// })
				}}>change value
				</button>
			</div>
		);
	}
}